package com.tianquan.miracledemo;


import com.tianquan.miracle.annotation.MiracleFastApplication;
import com.tianquan.miracle.context.ApplicationContext;
import com.tianquan.miracle.context.MiracleApplication;
import com.tianquan.miracledemo.test.aop.OrderService;
import com.tianquan.miracledemo.test.redisAop.User;
import com.tianquan.miracledemo.test.redisAop.UserServiceImpl;


@MiracleFastApplication
public class MiracleDemoApplication {

    public static void main(String[] args) {
        ApplicationContext context = MiracleApplication.run(MiracleDemoApplication.class, args);

/*        A bean = context.getBean(A.class);
        System.out.println(bean);

        C bean = context.getBean(C.class);
        System.out.println(bean);*/

        // RedissonClient redissonClient = (RedissonClient) context.getBean("redissonClient");
        // System.out.println(redissonClient);

        // 测试cglib
        UserServiceImpl userServiceImpl = (UserServiceImpl)context.getBean("userServiceImpl");
        User tianquan = new User(1L, "tianquan", 18);
        userServiceImpl.selectUser(tianquan);

        // 测试jdk
        OrderService orderService = (com.tianquan.miracledemo.test.aop.OrderService) context.getBean("orderServiceImpl");
        orderService.addUser();
        orderService.deleteUser();

        Object object = context.getBean("a");
        System.out.println("a==>" + object);

        // context.publishEvent(new Test(null));

    }

}
